<template>
  <div>
<div class="app-header">
    <div class="app-header-inner">
      <router-link :to="{path:'/'}">
    <img src="../assets/oeaomlogo.png" class="head-logo"/>
    </router-link>
      <div class="head-nav">
        <ul class="nav-list">
          <li>{{username}}</li>
          <li v-if="!username==''" class="nav-pile" >|</li>
          <li v-if="username==''" @click="loginClick">登录</li>
          <li v-if="username==''" class="nav-pile" >|</li>
          <li v-if="username==''" @click="registClick">注册</li>
          <li v-if="!username==''" @click="logout">退出</li>
          <li class="nav-pile">|</li>
          <li @click="aboutClick">关于</li>
        </ul>
      </div>
    </div>
</div>
<div class="app-content">
  <keep-alive>
  <router-view></router-view>
  </keep-alive>
</div>
<div class="app-footer">
<p>&copy;&nbsp;applicationsky&nbsp;LGPL</p>
</div>

<my-dialog :is-show="isShowLoginDialog"
 @on-close="closeDialog('isShowLoginDialog')">
<login-form @has-log="onSuccessLog"></login-form>
 </my-dialog>

 <my-dialog :is-show="isShowRegisterDialog"
 @on-close="closeDialog('isShowRegisterDialog')">
<register-form></register-form>
 </my-dialog>

 <my-dialog :is-show="isShowAboutDialog"
 @on-close="closeDialog('isShowAboutDialog')">
 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   本报告在调研数据的基础上，
   采用定性与定量相结合的方式
   深入分析了专车市场发展的驱
   动因素与阻碍因素、专车市场
   背后的产业格局、专车企业的
   竞争格局、用户对专车市场的
   依赖程度、专车对其他交通工
   具运力的补充效应等，通过这
   五个章节的研究反映专车市场
   的发展态势和面临的问题。报
   告力求客观、深入、准确地反
   映中国专车市场发展情况，为
   政府、企事业单位和社会各界
   提供决策依据。 </p>
 </my-dialog>
  </div>
</template>

<script>
import Dialog from './dialog'
import LoginForm from './logform'
import RegisterForm from './regform'
export default {
  name: 'HelloWorld',
  components:{
    myDialog : Dialog,
    LoginForm,
    RegisterForm

  },
  data () {
    return {
      isShowLoginDialog:false,
      isShowRegisterDialog:false,
      isShowAboutDialog:false,
      username:''
    }
  },
  methods:{
    aboutClick(){
      this.isShowAboutDialog = true
      console.log("about clicked...");
    },
     registClick(){
      this.isShowRegisterDialog = true
      console.log("about clicked...");
    },
     loginClick(){
      this.isShowLoginDialog = true
      console.log("about clicked...");
    },
    closeDialog(which){
      this[which] = false
      console.log("close "+which);
    },
    onSuccessLog(data){
      this.username=data.username
      console.log(data.username+'- in layout')
      this.closeDialog('isShowLoginDialog')
    },
    logout(){
      this.username=''
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}
ol, ul {
  list-style: none;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
body {
  background: #f0f2f5;
  font-family: "Helvetica Neue",Helvetica,Arial,"Hiragino Sans GB","Hiragino Sans GB W3","Microsoft YaHei UI","Microsoft YaHei","WenQuanYi Micro Hei",sans-serif;
  font-size: 14px;
  color: #444;
}


.app-header {
  background: #1E90FF;
  color: #e3e4e8;
  height: 90px;
  line-height: 90px;
  width: 100%;
}
.app-header-inner {
  width: 1200px;
  margin: 0 auto;
}
.head-logo {
  float: left;
}
.app-header-inner img {
  width: 50px;
  margin-top: 20px;
}
.head-nav {
  float: right;
}
.head-nav ul {
  overflow: hidden;
}
.head-nav li {
  cursor: pointer;
  float: left;
}
.nav-pile {
  padding: 0 10px;
}
.app-footer {
  text-align: center;
  height: 80px;
  width: 100%;
  line-height: 80px;
  background: #e3e4e8;
  clear: both;
  margin-top: 30px;
}
.container {
  width: 1200px;
  margin: 0 auto;
}
.hr {
  height: 1px;
  width: 100%;
  background: #ddd;
}
.button {
  background: #1E90FF;
  color: #fff;
  display: inline-block;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 4px;
  border-width: 0px;
}
.button:hover {
  background: #00BFFF;
}
.g-form {

}
.g-form-line {
  padding: 15px 0;
}
.g-form-label {
  width: 100px;
  font-size: 16px;
  display: inline-block;
}
.g-form-input {
  display: inline-block;
}
.g-form-input input {
  height: 30px;
  width: 200px;
  line-height: 30px;
  vertical-align: middle;
  padding: 0 10px;
  border: 1px solid #ccc;
}
.g-form-btn {
  padding-left: 100px;
}
.g-form-error {
  color: red;
  padding-left: 15px;
}
</style>
